-
Notifications
You must be signed in to change notification settings - Fork 3
Improve parser error reporting #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve parser error reporting #28
Conversation
acf9710 to
a65c5a7
Compare
seddonym
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow what a clever crate!
Left a couple of non-blocking comments, feel free to merge.
|
|
||
| message = str(exc_info.value) | ||
|
|
||
| # Recombine first line if it was too long |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this because there's a dependency on something like the system line length? I wonder if there's a way to make it deterministic so we don't need to do this. (No big deal though.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, when testing locally, the file_path is an absolute path, which was too long to fit on one line. I would have liked to make it deterministic, but I couldn't think of a clean way to do it. We probably do want absolute paths rather than relative (relative to what?) in real use.
tests/test_python_interface.py
Outdated
| message = "\n".join(lines) | ||
| # End recombination | ||
|
|
||
| assert message == f"""\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐼 Sometimes I like to use textutils.dedent so the string can match the indentation level of the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I considered that, but decided in this case this was good enough.
|
Oh - might be worth adding a line to the CHANGELOG about this, but no big deal. |
This uses the wonderful `miette` crate for annotating the `.flt` file source code.
a65c5a7 to
97e314c
Compare
Convert fluent errors into annotated source code, using the
miettecrate.